<?php
/*
 * Copyright 2008 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title>Buzz View</title> 
 
<link href="buzzview.css" rel="stylesheet" type="text/css" /> 
</head> 
<body>
<div class="buzz">
<?php

require_once './buzz-php-client-1.0/src/buzz.php';
require_once './displayBuzzPost.php';

try {
  // Storage doesn't really matter -- we'll be using public streams anyhow
  $storage = new buzzFileStorage('/tmp/buzzCache');

  // No auth, we're going to grab a public feed
  $auth = new buzzAuthNone();

  // Create the actual Buzz object with our Storage and Auth classes
  $buzz = new buzz($storage, $auth);
  
  // And fetch the @consumption posts
  $stream = $buzz->getPosts('@self', 'camicrepe', 16, 16, 24);

  // If we got here, the read action succeeded and we can display the posts
  if (count($stream->posts)) {
    foreach ($stream->posts as $post) {
      displayBuzzPost($buzz, $post);
    }
  } else {
    echo "No Google Buzz posts were found.";
  }
} catch (buzzException $error) {
  die("<b>Fatal error:</b> " . $error->getMessage());
}

?>
</buzz>
</body>
</html>